package com.gzs.learn.payment.api;

import com.gzs.learn.payment.IntegrationTestBase;
import com.gzs.learn.payment.failover.FailoverHandler;
import com.gzs.learn.payment.failover.FailoverService;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Random;
import java.util.concurrent.TimeUnit;

@Disabled
class DemoTestBase extends IntegrationTestBase {

    @Autowired
    private FailoverService service;

    @Test
    void testHandle() throws InterruptedException {
        final FailoverHandler<Object, Object> handler = new DemoFailoverHandler();
        final Random random = new Random();
        for (int i = 0; i < 100; i++) {
            final int param = random.nextInt(1000);
            // System.out.println(param);
            service.doFailOver(handler, param);
        }
        TimeUnit.SECONDS.sleep(10);
    }

}
